find_package( Boost REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
link_directories( ${Boost_LIBRARY_DIRS} )
set( Boost_USE_STATIC_LIBS        OFF )
set( Boost_USE_MULTITHREADED      ON )
set( Boost_USE_STATIC_RUNTIME     OFF )
set( BOOST_ALL_DYN_LINK           ON )

include_directories(${PYTHON_INCLUDE_DIRS})
link_directories(${Python_LIBRARY_DIRS})  # 要在add_executable或add_library的前面

include_directories("../helper")
include_directories("../external/fmt")
include_directories("../external/rapidjson/include")
# include_directories("./")

set(KBE_LIST
    ./util.h
    ./kbe.h
    ./kbe.cpp
    ./config.h
    ./config.cpp
    ./resmgr.h
    ./resmgr.cpp
    ./singleton.h
)

set(ALL_DIRS
    # common
    # helper
    # network
    # pyscript
    # thread
)

foreach(_comp ${ALL_DIRS})
    set(SRC_DIR_NAME ./${_comp})
    aux_source_directory(${SRC_DIR_NAME} CURR_SRC_LIST)
    file (GLOB CURR_HEADER_LIST ${SRC_DIR_NAME}/*.h)
    source_group(${_comp} FILES ${CURR_HEADER_LIST} ${CURR_SRC_LIST})
    list(APPEND KBE_LIST ${CURR_HEADER_LIST} ${CURR_SRC_LIST})
endforeach()

source_group("" FILES ${KBE_LIST})

set(KBE_STATIC_TARGET "kbe")
add_library(${KBE_STATIC_TARGET} STATIC ${KBE_LIST})

target_link_libraries( ${KBE_STATIC_TARGET} ${Boost_LIBRARIES} )
target_link_libraries( ${KBE_STATIC_TARGET} "fmt" )
target_link_libraries( ${KBE_STATIC_TARGET} "helper" )

set(KBE_STATIC_TARGET ${KBE_STATIC_TARGET} PARENT_SCOPE)

message("-- kbe")
